package com.hiquety.tcb.ui;

import com.hiquety.tcb.config.AppInfo;
import com.hiquety.tcb.entity.ClipboardItem;
import com.hiquety.tcb.handler.ListViewClickHandler;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.ListView;
import javafx.scene.control.ToolBar;
import javafx.scene.image.Image;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyCodeCombination;
import javafx.scene.input.KeyCombination;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;

public class IndexUI {
    public static Stage stage = new Stage();
    public static BorderPane pane = new BorderPane();
    public static Scene scene = new Scene(pane);
    public static final ObservableList<ClipboardItem> observableList = FXCollections.observableArrayList();
    public static final ListView<ClipboardItem> listView = new ListView<>(observableList);
    public static ToolBar toolBar = new ToolBar();
    public static Label label = new Label("点击复制到剪切板");

    static {
        double width = 248;
        double height = 422;
        double p = 0;
        stage.setWidth(width);
        stage.setHeight(height);
        stage.setMinWidth(width);
        stage.setMinHeight(height);
        listView.setPlaceholder(new Label("没有数据"));
        listView.setOnMouseClicked(new ListViewClickHandler());
        listView.setFocusTraversable(false);
        AnchorPane.setTopAnchor(listView, p);
        AnchorPane.setBottomAnchor(listView, p);
        AnchorPane.setLeftAnchor(listView, p);
        AnchorPane.setRightAnchor(listView, p);
        toolBar.setRotate(180);
        label.setRotate(180);
        pane.setBottom(toolBar);
        toolBar.getItems().add(label);
        pane.setCenter(IndexUI.listView);
        stage.setScene(scene);
        stage.setTitle(AppInfo.TITLE);
        stage.getIcons().add(new Image(AppInfo.ICON_PATH));
        stage.show();
    }
}
